package com.suoluo.zenadmin.dao.app;

import java.util.List;

import com.suoluo.zenadmin.vo.app.AppInstanceVO;

import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.SQL;

@DAO
public interface AppDAO {

	
	@SQL("select * from tb_app_instance where type=:1 and data_id=:2")
	public AppInstanceVO findTokenByTypeAndDataId(int type, int dataId);
	
	@SQL("select * from tb_app_instance limit :1,:2")
	public List<AppInstanceVO> findListApp(int startpage, int rows);
	
	@SQL("select count(*) from tb_app_instance")
	public int findAppCount();
	
	@SQL("insert into tb_app_instance(token,type,data_id,version,app_name) " +
			"values(:1.token,:1.type,:1.dataId,:1.version,:1.appName)")
	public void saveApp(AppInstanceVO app);
	
	@SQL("select * from tb_app_instance where id=:1")
	public AppInstanceVO findAppInstanceById(int id);
	
	@SQL("update tb_app_instance set version=:1.version,app_name=:1.appName where id=:1.id")
	public void updateApp(AppInstanceVO app);
}
